var facultiesReadyCallback, singleFacultyReadyCallback

function getFacultiesList(callback) {
  facultiesReadyCallback = callback;
  $.getJSON("/faculties.json", parseFaculties);
}

function parseFaculties(data) {
  facultiesReadyCallback(data)
}

function getFacultyWithGroups(faculty, callback) {
  singleFacultyReadyCallback = callback;
  $.getJSON("/faculties/" + faculty + ".json", parseSingleFaculty)
}

function parseSingleFaculty(data) {
  singleFacultyReadyCallback(data)
}